home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Monster Media 1996 #15
/
Monster Media Number 15 (Monster Media)(July 1996).ISO
/
prog_bas
/
pbc32.zip
/
PBC$BAS.ZIP
/
PATCH.BAS
< prev
next >
Wrap
BASIC Source File
|
1996-04-10
|
2KB
|
52 lines
' +----------------------------------------------------------------------+
' | |
' | PBClone (C) Copyright 1996 Charon Software, All Rights Reserved |
' | |
' +----------------------------------------------------------------------+
DECLARE SUB FClose1 (BYVAL FileHandle%)
DECLARE SUB FOpen1 (FileName$, BYVAL ReadWrite%, BYVAL Sharing%, FileHandle%, ErrCode%)
DECLARE SUB FSetOfs (BYVAL FileHandle%, Offset&)
DECLARE SUB SFRead (BYVAL FileHandle%, St$, BytesRead%, ErrCode%)
DECLARE SUB SFWrite (BYVAL FileHandle%, St$, BytesWritten%, ErrCode%)
DECLARE FUNCTION Patch01% ()
DECLARE SUB Patch00 (BYVAL FileHandle%)
SUB FindPatch (FileName$, SearchSt$, ErrCode%)
IF INSTR(FileName$, ".") THEN
File$ = FileName$
ELSE
File$ = FileName$ + ".EXE"
END IF
FOpen1 File$, 2, 2, Handle%, ErrCode%
Chunk$ = SPACE$(512)
DO UNTIL Found% OR ErrCode%
SFRead Handle%, Chunk$, BytesRead%, ErrCode%
St$ = RIGHT$(St$ + LEFT$(Chunk$, BytesRead%), 768)
IF ErrCode% <= 0 THEN
tmp% = INSTR(St$, SearchSt$)
IF tmp% THEN
Found% = -1
FSetOfs Handle%, CLNG(tmp% + LEN(SearchSt$) + 5 - LEN(St$))
Patch00 Handle%
END IF
END IF
LOOP
IF ErrCode% <= 0 THEN ErrCode% = NOT Found%
END SUB
SUB PatchDone
FClose1 Patch01%
END SUB
SUB SetPatch (St$)
Handle% = Patch01%
SFWrite Handle%, St$, BytesWritten%, ErrCode%
FSetOfs Handle%, 6&
END SUB